package win.smartown.kotlin.grammar

/**
 * Created by Smartown(<a href='https://github.com/smartown'>@Smartown</a>) on 2017/6/3.
 *
 * 使用条件表达式
 */
fun main(args: Array<String>) {
    println("max of 41 an 42 is ${maxNumber(41, 42)}")
    println("max of 41 an 42 is ${maxOf(41, 42)}")
}

fun maxNumber(a: Int, b: Int): Int {
    if (a > b) {
        return a
    } else {
        return b
    }
}

fun maxOf(a: Int, b: Int) = if (a > b) a else b
